package com.ltba.rf.control.beeper;

import java.io.FileInputStream;

import sun.audio.AudioPlayer;
import sun.audio.AudioStream;

public class Beeper implements Runnable{
	
	private int type = 0;
	
	private static final String [] SOUNDS = {"./data/Rooster.wav",
		"./data/ShipBell.wav",
		"./data/Siren.wav",
		"./data/StoreDoor.wav",
	};
	
	public Beeper(int type) {
		if(type < SOUNDS.length)
			this.type = type;
	}
	
	@Override
	public void run() {
		try {
			AudioStream as = new AudioStream(new FileInputStream(SOUNDS[type]));
			AudioPlayer.player.start(as);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
